<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>广告账户添加</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/static/layuiadmin/layui/css/layui.css" media="all">
</head>
<body>

<div class="layui-form" style="padding: 20px 30px 0 0;">

    <div class="layui-form-item">
        <label class="layui-form-label">广告账号ID</label>
        <div class="layui-input-block">
            <input type="text" name="advert_account" lay-verify="required" lay-verType="tips" lay-reqText="广告账号不能为空" placeholder="请输入广告账号ID" autocomplete="off" class="layui-input" />
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">投放媒体</label>
        <div class="layui-input-block">
            <select name="advert_media_id" lay-verify="advert_media_id" lay-verType="tips">
                <option value="0"></option>
                {foreach $advert_medias as $k => $v}
                <option value="{$k}">{$v}</option>
                {/foreach}
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">关联投放号</label>
        <div class="layui-input-block">
            <select name="channel_id" lay-search lay-verify="channel_id" lay-verType="tips">
            <option value="0">选择投放号</option>
            {foreach $channels as $k => $v}
            <option value="{$v.id}">{$v.account}</option>
            {/foreach}
            </select>
        </div>
    </div>

    <div class="layui-form-item layui-hide">
        <button class="layui-btn" lay-submit lay-filter="LAY-data-add-submit" id="LAY-data-add-submit">提交</button>
    </div>
</div>
<script src="/static/layuiadmin/layui/layui.js"></script>
<script>
    layui.config({
        base: '/static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'form'], function(){
        var $ = layui.$
            ,form = layui.form;

        form.verify({

            channel_id: function (value) {
                if(value < 1){
                    return '请选择关联投放号';
                }
            },
            advert_media_id: function (value) {
                if(value < 1){
                    return '请选择投放媒体';
                }
            },

        });

    })

</script>
</body>
</html>